/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.dominio;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 *
 * @author ronan
 */
@Entity
@Table(name = "disciplina")
public class Disciplina implements Serializable {
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(unique = true, nullable = false)
    private int codigoDisciplina;
    @Column (length = 10)
    private String ch;
    @Column(length = 100)
    private String nome;
    @Column(length = 100)
    private String ementa;
    
    

    public Disciplina() {
        
    }

    public Disciplina(String nome, String ementa, String ch) {
        this();
        this.nome = nome;
        this.ementa = ementa;
        this.ch = ch;
    }

    public Disciplina(String dados) {
        this();
        String[] arrayDados = dados.split("%%%");
        this.codigoDisciplina = Integer.parseInt(arrayDados[0]);
        this.nome = arrayDados[1];
        this.ementa = arrayDados[2];
        this.ch = arrayDados[3];
    }

    /**
     * @return the ch
     */
    public String getCh() {
        return ch;
    }

    /**
     * @param ch the ch to set
     */
    public void setCh(String ch) {
        this.ch = ch;
    }

    /**
     * @return the nome
     */
    public String getNome() {
        return nome;
    }

    /**
     * @param nome the nome to set
     */
    public void setNome(String nome) {
        this.nome = nome;
    }

    /**
     * @return the ementa
     */
    public String getEmenta() {
        return ementa;
    }

    @Override
    public String toString() {
        return this.getCodigoDisciplina() + "%%%" + this.nome + "%%%" + this.ementa + "%%%" + this.ch;
    }

    /**
     * @param ementa the ementa to set
     */
    public void setEmenta(String ementa) {
        this.ementa = ementa;
    }

    /**
     * @return the codigoDisciplina
     */
    public int getCodigoDisciplina() {
        return codigoDisciplina;
    }

    /**
     * @param codigoDisciplina the codigoDisciplina to set
     */
    public void setCodigoDisciplina(int codigoDisciplina) {
        this.codigoDisciplina = codigoDisciplina;
    }
}
